#include "Interrupt.h"  


//===================================================函数===================================================
/*---------------------------------------------------------------
 【函    数】(1)Time1_Interrupt_Enable
 【功    能】定时器2中断使能
 【参    数】无
 【返 回 值】无
 【注意事项】
 ----------------------------------------------------------------*/
void Time1_Interrupt_Enable(void)
{
	//使能中断,开启了更新中断到NVIC的通路
	TIM_ITConfig(TIM1,TIM_IT_Update,ENABLE);
	
	//配置NVIC，配置优先级
	//先选择分组
	NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
	//
	NVIC_InitTypeDef NVIC_TIM2_InitStructure;
	NVIC_TIM2_InitStructure.NVIC_IRQChannel = TIM2_IRQn;
	NVIC_TIM2_InitStructure.NVIC_IRQChannelCmd = ENABLE;
	NVIC_TIM2_InitStructure.NVIC_IRQChannelPreemptionPriority = 2;
	NVIC_TIM2_InitStructure.NVIC_IRQChannelSubPriority = 1;
	NVIC_Init(&NVIC_TIM2_InitStructure);
}
/*---------------------------------------------------------------
 【函    数】(1)Time2_Interrupt_Enable
 【功    能】定时器2中断使能
 【参    数】无
 【返 回 值】无
 【注意事项】
 ----------------------------------------------------------------*/
void Time2_Interrupt_Enable(void)
{
	//使能中断,开启了更新中断到NVIC的通路
	TIM_ITConfig(TIM2,TIM_IT_Update,ENABLE);
	
	//配置NVIC，配置优先级
	//先选择分组
	NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
	//
	NVIC_InitTypeDef NVIC_TIM2_InitStructure;
	NVIC_TIM2_InitStructure.NVIC_IRQChannel = TIM2_IRQn;
	NVIC_TIM2_InitStructure.NVIC_IRQChannelCmd = ENABLE;
	NVIC_TIM2_InitStructure.NVIC_IRQChannelPreemptionPriority = 2;
	NVIC_TIM2_InitStructure.NVIC_IRQChannelSubPriority = 1;
	NVIC_Init(&NVIC_TIM2_InitStructure);
}
